<?php

abstract class BaseTestData {
    
    protected $rows = null;

    public function __construct () {
        if (empty($this->rows)) {
            throw new Exception('the test data cann`t be null');
        }
    }

    public function getRows () {
        return $this->rows;
    }

    public function getRow () {
        return $this->rows[array_rand($this->rows)];
    }

    public function getColumn ($columnName, $rows = null) {
        if (empty($rows)) {
            $rows = $this->rows;
        }
        $result = array();
        foreach ($rows as $row) {
            $result[] = $row[$columnName];
        }
        return $result;
    }
}